# Contributor: Stefan Wagner <stw@bit-strickerei.de>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-pyphen
pkgver=0.17.0
pkgrel=0
_pkgname=Pyphen
pkgdesc="Python-based dictionary hyphenator library"
url="https://pyphen.org/"
arch="noarch"
license="GPL-2.0-or-later AND LGPL-2.1-or-later AND MPL-1.1"
makedepends="py3-flit-core py3-gpep517"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/Kozea/Pyphen/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-pyphen" # Backwards compatibility
provides="py-pyphen=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
3b3bc4a2ec81d5642c93b31c27b0138f154f3a6c9002da6eb440ab953116e1f5269cf81f8daef08fb684d64d952cfe86f00b84ea79efdab8163cdf25f6ec8a11  Pyphen-0.17.0.tar.gz
"
